Viewer Spelling Word Viewer Courier wwwwp Form1* IconWrks Viewer FormTitle Select Spelling File Pic_VerticalLine System Spell_Words Spelling Words SpellWordList Pic_HorizontalLine Txt_FileName Lbl_File Fi&le: Lbl_Directory Directory: Lbl_CurrentDirectory Lbl_Directories &Directories: Pic_IconCount Lbl_Icons &Spelling Files Dir_DirectoryList File_FileList *.ace Lbl_Drives Dri&ves: Drv_DriveList Menu_Drill S&pell Menu_ChangeWords &Change Words Menu_Exit E&xit Menu_Help &Help Menu_HelpSelection &Index Menu_HelpSelection &Keyboard Menu_HelpSelection &Commands Menu_HelpSelection &Using Help Menu_HelpSelection Menu_HelpSelection &About... Badicon @ Form_Load Pic_IconsBitmap Pic_SelectediconB BackColor WHITE ViewerLoaded Menu_OptionsSelection MID_SHOW_ON_DIR_CHANGE Checkedn GetPrivateProfileInt APP_NAME4 KEY_SHOW_ICONSu INI_FILENAME ScreenQ Widthd HeightA MinViewerWidth Pic_VerticalLine Scrl_AllIcons ICON_CELLX ScaleWidth MinViewerHeight ScaleHeightL MID_SHOW_ALL_ICONSQ Enabled File_FileList ListCount Lbl_Icons Caption Lbl_CurrentDirectoryy Dir_DirectoryList Txt_FileName TextD Pattern VLastChanged4 DIR_CHANGEDM Menu_FileSelectionc MID_EXIT A_TAB8 Menu_OptionsSelection_Click Form_Resize WindowState MINIMIZED~ NewWidthq NewHeight Adjust_All_ControlsB ValueG MaxIcons ShowingAllIcons IconColumns LargeChange6 IconRows Visible Update_Displayed_Icons; Pic_AllIconsZ NumIconRows FirstIcon PixelWidth1 BitBlt SRCCOPY Load_All_Icons[ FALSEj AutoRedraw ForeColor Pic_IconCount MousePointer HOURGLASS CurrentX Valid_Icon} BLACKNESS$ DEFAULTq WINDOW_TEXT1 WINDOW_BACKGROUND4 Dir_DirectoryList_Change UpDate_FileSpec ViewerG Menu_EditCopy_Click Clipboard image} Pic_AllIcons_Paint< Pic_AllIcons_MouseDownl Button Shift LEFT_BUTTON XIcon_ YIcon SelectedIconl ListIndex DragIcon Scrl_AllIcons_Change Pic_SelectedIcon_MouseDown File_FileList_Click FileName Menu_EditCopyK FILE_CHANGED File_FileList_PathChange Picture File_FileList_DblClick Open_Selected_Icon File_FileList_KeyPress KeyAscii Txt_FileName_KeyPressc AllIconsVisiblez NewAllIconsWidthy Drv_DriveList Lbl_Drives Menu_HelpSelection_Click Indexw MID_ABOUT MID_KEYBOARDD MID_COMMANDS Get_Help[ AboutBoxF MODAL' MID_EDITOR Editor MODELESS Dir_DirectoryList_Click Txt_FileName_Change FILENAME_CHANGED Dir_DirectoryList_KeyPress OldPatternx ValidName Validate_FileSpec drive7 Load_An_Icona Drv_DriveList_Change Validate_And_Change_Drives$ @ Menu_FileSelection_Click MID_OPENG Menu_File_Click Form_UnloadP Cancel WinHelp hwndY dummy= HELP_QUIT% WritePrivateProfileString1 MainForm ICONWORKS_VIEWER EditorLoadedL MBYES ICONWORKS_EDITOR0 Pic_SelectedIconLabel_Paint Pic_SelectedIconLabele CurrentY Prompt Open_Selected_File Menu_ChangeWords_Click Open_Selected_Spell Pic_IconsBitmap_Click Lbl_Directory_Click Lbl_File_Click] Pic_IconCount_Click Lbl_Directories_Clickw Lbl_Icons_Click SpellWordList_Change Label1_Click FileNum OpenError SpellWordList Pic_VerticalLine_Click Load_All_Words NextLine LineFromFile Spell_Words Update_Displayed_Words SpellWords Menu_Options_Click Pic_HorizontalLine_Click MgBox8 Menu_Exit_Click Menu_Drill_Click Menu_Exit NumWords Spelling_Drill Lbl_CurrentDirectory_Click& Form_Load Inform rest of Iconworks that the Viewer is loaded. Viewer.Visible could be tested but accessing the visible property would cause the Viewer to be loaded if not already loaded. Menu_OptionsSelection(MID_SHOW_ON_DIR_CHANGE).Checked = -GetPrivateProfileInt(APP_NAME, KEY_SHOW_ICONS, 0, INI_FILENAME) Center Viewer Calculate the Minimum width and Height for the Viewer. This is done, sor the smallest window allowed will still allow easy access to all controls. Enable the "Show all icons' menu option only if the current directory contains iconso Menu_OptionsSelection(MID_SHOW_ALL_ICONS).Enabled = File_FileList.ListCount > 0P Display the number of icons in the current directory, display the current directory, and set the current file name to the default file spec of "*.ACE", which was set at design time into the File ListBox.c &Spelling Files The Alt+F4 accelerator for Exit, cannot be assigned using the Menu design Window, so we need to put the accelerator into the caption. Alt+F4 is actually the System menus Close option. Menu_Exit.Caption = "E&xit" + A_TAB + "Alt+F4" If Menu_OptionsSelection(MID_SHOW_ON_DIR_CHANGE).Checked And (File_FileList.ListCount <> 0) Then Menu_OptionsSelection_Click MID_SHOW_ALL_ICONSI Form_Resize The Form has been resized, so we need to resize and possible reposition some of the controls on the form, however, we do not want to do anything if the form is minimized. Check if new size is less than the minimum Viewer size. The form is smaller than the minimum size, either in width or height, so reset the width and/or height to the minimum values. The form is greater than the minimum width and height valuese so adjust any controls that need resizing or repositioning. SpellWordList.Value = 0i There are more icons that can be displayed at once within the current new size of the Form, so we need to calculate new Max and LargeChange values for the scrollbar. SpellWordList.Max = Diff \ IconColumns If (Diff Mod IconColumns) Then SpellWordList.Max = SpellWordList.Max + 1 SpellWordList.LargeChange = IconRows SpellWordList.Visible = TRUE' And (File_FileList.ListCount > MaxIcons) Dir_DirectoryList_Change A new directory has been selected, so Set current directory to the newly selected directory Display the newly selected directoryo Inform the File ListBox of the PathChange.c Display new filespec in FileName TextBoxe Pic_AllIcons_Paint A portion of the viewing area needs to be updated, so if we are currently displaying any icons, Update the viewing area. File_FileList_Click When a file is selected from the File Listbox with single click from the mouse, this routine displays the selected file just abovea the file listbox if it is a valid word file.o File_FileList_PathChange There are no words in the current directory Spelling Words Display the number of icons in the current directoryu &Spelling Files File_FileList_DblClick Double Clicking a file within the File ListBox signals that ane existing file has been selected, so attempt to open the file. File_FileList_KeyPress Pressing Enter when the File ListBox has the Focus should react just as if the File ListBox was Double Clicked, so all we needt to do is attempt to open the selected file. Txt_FileName_KeyPress Enter was pressed, so cancel the KeyStroke to prevent a Beep, and attempt to open the selected file as an Icon. Adjust_All_Controls Save the visibility state of the Icon viewing window, since we resize it whether it is visible or not.i Hide all controls that can be resized, while the actual resizing is being done. This prevents uneccessary screen updates.l Resize and Repostion affected controlsb SpellWordList.Move SpellWordList.Left, SpellWordList.Top, NewAllIconsWidth, ScaleHeight0 SpellWordList.Height = ScaleHeight + 2 Redisplay controls hidden before resizing and reposition was done Menu_HelpSelection_Click Determine what help topic to display. The *Index* and *Using Help* items are the same for both the Viewer and the Editor, but theH items: Keyboard and Commands are different and have different Help topic ID's, so we add 3 to the Menu item which will then make the Index correspond to the correct Help topic. Display the IconWorks About box Dir_DirectoryList_Click The actual directory has not changed since the Directory ListBox was only single clicked , so all we need to do is display the new filea spec for the selected directory in the FileName TextBox.e Txt_FileName_Change Dir_DirectoryList_KeyPress Pressing Enter when the Directory ListBox has the Focus shouldf react just as if the Directory ListBox was double clicked, so all we need to do is set the Path property of the Directory control to the selected directory. Drv_DriveList_Change Selecting a drive from a Drive control does not generate an error if the selected drive is not ready, so we verify that the drive is in fact ready before we accept the drive. Menu_FileSelection_Click One of the 2 File menu items were selected, so determine which one and perform the corresponding task. Menu_File_Click Before displaying the file menu, enable or disable the File.Openn command, based on whether or not an Icon is currently selected. Menu_FileSelection(MID_OPEN).Enabled = File_FileList.ListIndex >= 0 Form_Unload Let the rest of IconWorks know that the Viewer is no longer loaded. R = WritePrivateProfileString(APP_NAME, KEY_SHOW_ICONS, Format$(Abs(Menu_OptionsSelection(MID_SHOW_ON_DIR_CHANGE).Checked)), INI_FILENAME) If the Viewer was started up first then we treat it as the main Form. So, if the Editor is loaded, we should as the user if the Editor should also be terminated. Open_Selected_File The directory was the last control accessed, so we need only set its Path to is currently selected item, which will generate a Change event for the Directory control, which will take caree of updating the other related controlso The FileName TextBox or the File ListBox was last accessed. Validate the filename only if the FileName TextBox was the last control accessed. We do not need to Validate the Filename if the File ListBox was last accessed since if the FileName is listed, then the File exists. The FileName entered into the FileName TextBox many have contained a new drive and path, so in case it did, we need to inform thei Drive and Directory controls of this change.n Set Err to no Error (FALSE) and attempt to load the selected file File open error The error message for error number " Sorry your spelling word file is too large File too Big Load_All_Words When a request is made to display all the words in the current directory this routine is called to perform the task. Refresh the File listbox to pick up any files that might have beene added to the current directory since this directory was selected. Determine if the scrollbar is needed. If there are more icons in the current directory than can be displayed at once, the scrollbar must be active to allow viewing of all the icons.n Display the Icon Viewing window 0 Spelling Words Line Input #FileNum, NextLine$ as each line is read, add it to those preceddingit, then replace the terminator (lineinput drops them)) Spelling Words" Spelling Words" Update_Displayed_Words When the form is resized, the scrollbar is scrolled, or anything causing the. currently displayed icons to be updated, this routine is called to displayh or redisplay the viewing window.n Menu_Exit_Click Menu_ChangeWords_Click notepad.exe Menu_Drill_Click